package com.project.service.impl;

import java.util.List;
import java.util.Map;

import com.project.entity.PersonInfo;
import com.project.entity.PersonInfoExample;
import com.project.entity.UnitInfo;
import com.project.mapper.PersonInfoMapper;
import com.project.service.PersonInfoManage;
/**
 * 人员信息服务实现类
 * 作者：甘雨
 **/
public class PersonInfoManageService implements PersonInfoManage {
	private PersonInfoMapper personInfoMapper;
	

	public PersonInfoMapper getPersonInfoMapper() {
		return personInfoMapper;
	}

	public void setPersonInfoMapper(PersonInfoMapper personInfoMapper) {
		this.personInfoMapper = personInfoMapper;
	}


	public void deleteById(Integer personInfoId) {
		this.personInfoMapper.deleteByPrimaryKey(personInfoId);

	}

	public List<PersonInfo> getAllPerson() {
		PersonInfoExample example = new PersonInfoExample();
		return this.personInfoMapper.selectByExample(example);
	}

	public PersonInfo getById(Integer personInfoId) {
		return this.personInfoMapper.selectByPrimaryKey(personInfoId);
	}

	public void updateById(PersonInfo personInfo) {
		this.personInfoMapper.updateByPrimaryKey(personInfo);

	}
	
	public void insertPersonInfo(PersonInfo personInfo){
		this.personInfoMapper.insert(personInfo);
	}

	public int countAllPerson(Map<String, String> map) {
		// TODO Auto-generated method stub
		int i ;
		try{
			i = this.personInfoMapper.countPerson(map);
		}catch(Exception e){
			i = -1;
			e.printStackTrace();
		}
		return i;
	}

	public List<PersonInfo> getAllPersons(Map<String, String> map) {
		// TODO Auto-generated method stub
		List<PersonInfo> list;
		try{
			list = this.personInfoMapper.getAllPerson(map);
		}catch(Exception e){
			list = null;
			e.printStackTrace();
		}
		return list;
	}

	public List<PersonInfo> conditionSelect(PersonInfo record, Integer start,
			Integer limit) {
		List<PersonInfo> list = this.personInfoMapper.conditionSelect(record, start, limit);
		return list;
	}

}
